<template>
	<view class="coupon-item">
		<view class="con">
			<view class="left">
				<text class="title">{{data.title}}</text>
				<text v-if="endUseDate"  class="time">有效期至{{endUseDate}}</text>
				<text v-else class="time">长期有效</text>
			</view>
			<view class="right">
				<text class="price">{{data.coupon_price}}</text>
				<text v-if="data.use_min_price == 0">无限制条件</text>
				<text v-else>满{{data.use_min_price}}可用</text>
			</view>
			
			<view class="circle l"></view>
			<view class="circle r"></view>
		</view>
		<text class="tips">{{data.desc}}</text>
	</view>
</template>

<script>
	export default {
		name:"coupon",
		props:{
			data: {
				type: Object,
				default () {
					return null;
				}
			},
			endUseDate: {
				type: String,
				default () {
					return "";
				}
			}
		},
		data() {
			return {
				
			};
		}
	}
</script>

<style lang="scss" scoped>
	/* 优惠券列表 */
	.coupon-item{
		display: flex;
		flex-direction: column;
		margin: 20upx 24upx;
		background: #fff;
		.con{
			display: flex;
			align-items: center;
			position: relative;
			height: 120upx;
			padding: 0 30upx;
			&:after{
				position: absolute;
				left: 0;
				bottom: 0;
				content: '';
				width: 100%;
				height: 0;
				border-bottom: 1px dashed #f3f3f3;
				transform: scaleY(50%);
			}
		}
		.left{
			display: flex;
			flex-direction: column;
			justify-content: center;
			flex: 1;
			overflow: hidden;
			height: 100upx;
		}
		.title{
			font-size: 32upx;
			color: $font-color-dark;
			margin-bottom: 10upx;
		}
		.time{
			font-size: 24upx;
			color: $font-color-light;
		}
		.right{
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			font-size: 26upx;
			color: $font-color-base;
			height: 100upx;
		}
		.price{
			font-size: 44upx;
			color: $base-color;
			&:before{
				content: '￥';
				font-size: 34upx;
			}
		}
		.tips{
			font-size: 24upx;
			color: $font-color-light;
			line-height: 60upx;
			padding-left: 30upx;
		}
		.circle{
			position: absolute;
			left: -6upx;
			bottom: -10upx;
			z-index: 10;
			width: 20upx;
			height: 20upx;
			background: #f3f3f3;
			border-radius: 100px;
			&.r{
				left: auto;
				right: -6upx;
			}
		}
	}
</style>
